package com.lx.yygh.controller;

import com.lx.yygh.common.result.Result;
import com.lx.yygh.service.SmsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author c先生
 * @date 2022年10月20日 下午 3:12:11
 * @describe
 */
@Api(tags = "短信发送模块")
@RestController
@RequestMapping("/api/sms")
public class SmsController {
    @Resource
    SmsService smsService;

    @ApiOperation("发送短信")
    @GetMapping("/sendMessage/{phone}")
    public Result sendMessage(@PathVariable("phone")String phone){
        boolean b = smsService.sendMessage(phone);
        if(b){
            return Result.ok();
        }
        return Result.fail().message("发送短信失败");
    }
}
